package cn.kais.drawer.menu;

import java.util.Objects;

/**
 * 评分图标 种类
 * 星星
 * 辣椒
 * 水滴
 * ...
 */
public enum MenuScoreIcon {

    STARS_A("el-icon-star-on", "a", "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\">\n" +
            "    <path fill=\"#000\" fill-rule=\"nonzero\"\n" +
            "          d=\"M10.25 34.863c-1.035.516-2.238.516-3.273-.172-.86-.687-1.38-1.894-1.207-2.93l1.378-8.093c0-.344 0-.688-.343-.86l-5.856-6.03c-.687-.86-1.035-2.067-.687-3.102s1.379-1.895 2.41-2.067l8.266-1.207c.343 0 .687-.172.687-.515l3.617-7.407c.516-1.035 1.551-1.722 2.754-1.722s2.238.687 2.754 1.722l3.617 7.407c.172.343.516.515.688.515l8.265 1.207c1.207.172 2.067 1.036 2.41 2.067.344 1.035 0 2.238-.687 3.101l-5.848 5.856a1.3 1.3 0 0 0-.343.86l1.375 8.097c.171 1.207-.344 2.238-1.207 2.93-.86.687-2.239.687-3.274.171l-7.406-3.789c-.344-.172-.688-.172-.86 0z\"/>\n" +
            "</svg>"), // 星星 全
    STARS_B("el-icon-star-on", "b", "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\">\n" +
            "    <path fill=\"#000\" fill-rule=\"nonzero\"\n" +
            "          d=\"M17.996.758c1.203 0 2.238.687 2.754 1.722l3.617 7.407c.172.343.516.515.688.515l8.265 1.207c1.207.172 2.067 1.036 2.41 2.067.344 1.035 0 2.238-.687 3.101l-5.848 5.856a1.3 1.3 0 0 0-.343.86l1.375 8.097c.171 1.207-.344 2.238-1.207 2.93-.86.687-2.239.687-3.274.171l-7.406-3.789c-.344-.172-.688-.172-.86 0l-7.23 3.961c-1.035.516-2.238.516-3.273-.172-.86-.687-1.38-1.894-1.207-2.93l1.378-8.093c0-.344 0-.688-.343-.86l-5.856-6.03c-.687-.86-1.035-2.067-.687-3.102s1.379-1.895 2.41-2.067l8.266-1.207c.343 0 .687-.172.687-.515l3.617-7.407c.516-1.035 1.551-1.722 2.754-1.722M18 3.295v25.08h-.013a2.4 2.4 0 0 1 1.333.352l7.106 3.636c.332.164.66.164.992 0s.496-.66.332-.992l-1.32-7.766c-.164-.992.164-1.984.828-2.644l5.617-5.617c.332-.332.332-.66.164-.992s-.496-.66-.828-.66l-7.93-1.157c-.992-.164-1.816-.66-2.148-1.652l-3.469-7.106A.89.89 0 0 0 18 3.295\"/>\n" +
            "</svg>"), // 星星 半
    STARS_C("el-icon-star-on", "c", "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\">\n" +
            "    <path fill=\"#000\" fill-rule=\"nonzero\"\n" +
            "          d=\"m19.32 28.727 7.106 3.636c.332.164.66.164.992 0s.496-.66.332-.992l-1.32-7.766c-.164-.992.164-1.984.828-2.644l5.617-5.617c.332-.332.332-.66.164-.992s-.496-.66-.828-.66l-7.93-1.157c-.992-.164-1.816-.66-2.148-1.652l-3.469-7.106a.91.91 0 0 0-.828-.496.91.91 0 0 0-.828.496l-3.309 7.27c-.496.828-1.32 1.488-2.312 1.652L3.62 13.855c-.332 0-.66.332-.828.66-.164.333 0 .66.164.993l5.621 5.617c.66.66.992 1.652.828 2.645l-1.32 7.765c0 .332.164.66.332.992.164.332.66.164.992 0l7.106-3.636c.984-.66 1.976-.66 2.804-.164m-9.07 6.136c-1.035.516-2.238.516-3.273-.172-.86-.687-1.38-1.894-1.207-2.93l1.378-8.093c0-.344 0-.688-.343-.86l-5.856-6.03c-.687-.86-1.035-2.067-.687-3.102s1.379-1.895 2.41-2.067l8.266-1.207c.343 0 .687-.172.687-.515l3.617-7.407c.516-1.035 1.551-1.722 2.754-1.722s2.238.687 2.754 1.722l3.617 7.407c.172.343.516.515.688.515l8.265 1.207c1.207.172 2.067 1.036 2.41 2.067.344 1.035 0 2.238-.687 3.101l-5.848 5.856a1.3 1.3 0 0 0-.343.86l1.375 8.097c.171 1.207-.344 2.238-1.207 2.93-.86.687-2.239.687-3.274.171l-7.406-3.789c-.344-.172-.688-.172-.86 0z\"/>\n" +
            "</svg>"), // 星星 空
    CHILI("chili", "", ""), // 辣椒
    ;

    public final String code;
    public final String state;
    public final String value;

    MenuScoreIcon(String code, String state, String value) {
        this.code = code;
        this.state = state;
        this.value = value;
    }

    public static MenuScoreIcon onParseCode(String code, String state) {
        for (MenuScoreIcon menu : MenuScoreIcon.values()) {
            if (Objects.equals(menu.code, code) && Objects.equals(menu.state, state)) {
                return menu;
            }
        }
        return STARS_A;
    }

}
